package com.llkj.youdaocar.httpUtils;

import android.content.Context;

import java.util.HashMap;

/**
 * 如果参数少于3个就直接传入value，如果多于3个就直接出入map
 */
public class HttpMethod {
    public static final String HOME_INDEX = "http://101.200.63.2:8080/ydqcweb/index.html";
    //
    private static final String ROOT_URL = "http://101.200.63.2/ydqc/";
    /**
     * 1.1 注册
     */
    public static final String LOGIN_REGISTER = ROOT_URL + "dingw";
    public static final int HTTP_LOGIN_REGISTER = 100011;

    public static void updataeLocation(Context mContext, AnsynHttpRequest.ObserverCallBack callback, String uid, String lat, String lng) {
        HashMap<String, String> params = new HashMap<>();
        params.put("lat", lat);
        params.put("lon", lng);
        params.put("user_id", uid);

        AnsynHttpRequest.requestGetOrPost(mContext, AnsynHttpRequest.GET, LOGIN_REGISTER, params, callback, HTTP_LOGIN_REGISTER);
    }

    /**
     * 1.1 注册登录
     */
    public static final String LOGIN_LOGIN = ROOT_URL + "user/thirdlogin";
    public static final int HTTP_LOGIN_LOGIN = 100012;

    public static void login(Context mContext, AnsynHttpRequest.ObserverCallBack callback, String nickName, String uid, String type,String headImg) {
        HashMap<String, String> params = new HashMap<>();
        params.put("nickName", nickName);
        params.put("uid", uid);
        params.put("type", type);
        params.put("headImg", headImg);

        AnsynHttpRequest.requestGetOrPost(mContext, AnsynHttpRequest.POST, LOGIN_LOGIN, params, callback, HTTP_LOGIN_LOGIN);
    }

    /**
     * 协议
     */
    public static final String LOGIN_QUERY_PROTOCOL= ROOT_URL + "common/queryProtocol";
    public static final int HTTP_QUERY_PROTOCOL = 100013;

    public static void queryProtocol(Context mContext, AnsynHttpRequest.ObserverCallBack callback,String type) {
        HashMap<String, String> params = new HashMap<>();
        params.put("type", type);

        AnsynHttpRequest.requestGetOrPost(mContext, AnsynHttpRequest.POST, LOGIN_QUERY_PROTOCOL, params, callback, HTTP_QUERY_PROTOCOL);
    }

    /**
     * 广告
     */
    public static final String LOGIN_AD= ROOT_URL + "imglink/queryImgLink";
    public static final int HTTP_LOGIN_AD = 100014;

    public static void ad(Context mContext, AnsynHttpRequest.ObserverCallBack callback,String type) {
        HashMap<String, String> params = new HashMap<>();
        params.put("type", type);

        AnsynHttpRequest.requestGetOrPost(mContext, AnsynHttpRequest.POST, LOGIN_AD, params, callback, HTTP_LOGIN_AD);
    }
}
